from flask import Flask
from flask_cors import CORS
from src.common.config import config
from src.common.request_process import register_request_handlers
from src.modules import init_db_session, register_blueprint_api

def create_app():

    app = Flask(__name__)

    flask_config = config.get_flask_config()
    app.config.from_mapping(flask_config)

    register_blueprint_api(app)

    register_request_handlers(app)

    init_db_session(app)

    CORS(app)

    return app

app = create_app()
